layui.use(['table', 'admin', 'ax', 'func', 'form'], function () {
    var $ = layui.$;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;
    var form = layui.form;
    var func = layui.func;

    /**
     * vocs排放量管理
     */
    var VocsEmission = {
        tableId: "vocsEmissionTable"
    };

    /**
     * 初始化表格的列
     */
    VocsEmission.initColumn = function () {
        return [[
            {field: 'id', hide: true, title: '序号'},
            {field: 'companyName', sort: true, title: '所属企业'},
            {field: 'countyName', sort: true, title: '所属县区'},
            {field: 'actualEmissions', sort: true, title: '实际排放量'},
            {field: 'estimatedEmissions', sort: true, title: '减排量估算'},
            {field: 'afterEmissions', sort: true, title: '减排后排放量'},
            {field: 'units', sort: true, title: '单位'},
            {field: 'remark', sort: true, title: '备注'}

        ]];
    };

    /**
     * 点击查询按钮
     */
    VocsEmission.search = function () {
        var queryData = {};
        queryData['condition'] = $("#condition").val();
        table.reload(VocsEmission.tableId, {
            where: queryData, page: {curr: 1}
        });
    };




    //获取详情信息，填充表单
    var ajax = new $ax(Feng.ctxPath + "/emissionSummary/totalSummary");
    var result = ajax.start();
    $('#totalActual').val(result.data.totalActual);
    $('#totalSummary').val(result.data.totalSummary);
    $('#totalAfter').val(result.data.totalAfter);

    // 渲染表格
    var tableResult = table.render({
        elem: '#' + VocsEmission.tableId,
        url: Feng.ctxPath + '/emissionSummary/list',
        page: true,
        height: "full-158",
        cellMinWidth: 100,
        totalRow:{
            "afterEmissions":999
        },
        cols: VocsEmission.initColumn()
    });



});
